package xendit

import (
	"time"

	"gorm.io/gorm"
)

type InvoiceNotify struct {
	Id                    string     `json:"id"`
	UserId                string     `json:"user_id"`
	ExternalId            string     `json:"external_id"`
	IsHigh                bool       `json:"is_high"`
	MerchantName          string     `json:"merchant_name"`
	Amount                int64      `json:"amount"`
	Status                string     `json:"status"`
	PayerEmail            string     `json:"payer_email"`
	Description           string     `json:"description"`
	FeesPaidAmount        int64      `json:"fees_paid_amount"`
	AdjustedReceiveAmount int64      `json:"adjusted_receive_amount"`
	PaymentMethod         string     `json:"payment_method"`
	PaymentChannel        string     `json:"payment_channel"`
	PaymentDestination    string     `json:"payment_destination"`
	BankCode              string     `json:"bank_code"`
	RetailOutletName      string     `json:"retail_outlet_name"`
	EvalletType           string     `json:"evallet_type"`
	OnDemandLink          string     `json:"on_demand_link"`
	RecurringPaymentId    string     `json:"recurring_payment_id"`
	CreditCardChargeId    string     `json:"credit_card_charge_id"`
	Updated               *time.Time `json:"updated"`
	Created               *time.Time `json:"created"`

	CreateTime *time.Time `json:"create_time"`
}

func (InvoiceNotify) TableName() string {
	return "xen_invoice_notify"
}

func (item *InvoiceNotify) BeforeCreate(tx *gorm.DB) error {
	var now = time.Now()
	item.CreateTime = &now
	return nil
}
